﻿@model IEnumerable<TrainingManagerSystem.WebUI.TrainingManagerSystemService.LanguageScore>
<div class="box-title">
    <h3>
        <i class="icon-bar-chart"></i>
        Language Score
    </h3>                            
</div>
<div class="box-content nopadding fix-height-300">
    <table class="table table-hover table-nomargin" id="table-LanguageScore">
        <thead>
            <tr>
                <th>Language Name</th>
                <th>Score</th>
                <th>Date</th>
            </tr>
        </thead>
        <tbody>
            @foreach(var item in Model) {
                <tr>
                    <td>
                        <a class="acc" href="#" data-languageTypeId="@item.LanguageTypeId" data-employeeId="00000007"> @item.LanguageName</a>
                       
                    </td>
                    <td>
                        @item.Score
                    </td>
                    <td>
                        @if(item.Date!=null) {
                            @item.Date.Value.ToString("dd-MMM-yyyy")
                        }
                       
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
<div id="personLanguageScore" class="home-details">
</div>
<script src="~/Content/Scripts/jquery-1.7.1.min.js"> </script>
<script src="~/Content/Scripts/jquery.dataTables.min.js"> </script>
<script src="~/Content/Scripts/jquery.dataTables.min.js"> </script>
<script src="~/Content/Scripts/jquery.bpopup.min.js"> </script>
<script src="~/Content/Scripts/convertDatetimeJson.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("#personLanguageScore").hide();
        $("#table-LanguageScore tr td a").click(function() {
            $.ajax({
                url: '/LanguageScore/HistoryLanguageScoreByTypeAndEmployeeId',
                type: 'POST',
                data: { languageTypeId: $(this).attr('data-languageTypeId'), employeeId: $(this).attr('data-employeeId') },
                dataType: 'json',
                success: function (data) {
                    var html = "<div class='acTitle'>History Language Score</div>";
                    html += "<div class='popup-overflow'><table class='popup-tables' width='100%'><tr><th>Language Name</th><th>Score</th><th>Date</th></tr>";
                    for (var i = 0; i < data.length; i++) {
                        html += "<tr><td>" + data[i].LanguageName + "</td>";
                        html += "<td>" + data[i].Score + "</td>";
                        html += "<td>" +formatJSONDate(data[i].Date) + "</td></tr>";
                    }
                    html += "</table></div>";
                    $("#personLanguageScore").html(html);
                    $("#personLanguageScore").bPopup();
                },
                error: function() {
                    alert('Error!');
                }
            });
        });
    });

</script>
